package com.haruhinav.service.impl;

import com.haruhinav.entity.PicApi;
import com.haruhinav.mapper.PicApiMapper;
import com.haruhinav.service.PicApiService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PicApiServiceImpl implements PicApiService {
    @Resource
    private PicApiMapper picApiMapper;

    @Override
    public Map<String,Object> getAllPicApi() {
//        获取所有图片api
        List<PicApi> picApis = picApiMapper.getAllPicApi();
//        实例map
        Map<String,Object> picApiMap = new HashMap<>();
//        实例字符串集合
        List<String> picApiStrList = new ArrayList<>();
//        将图片api放进string集合
        for(PicApi picApi:picApis){
            picApiStrList.add(picApi.getApi());
        }
//        添加进map
        picApiMap.put("apiObjList",picApis);
        picApiMap.put("apiStrList",picApiStrList);
        return picApiMap;
    }


}
